# Contributor: Runar Tenfjord < runar dot tenfjord at gmail dot com >

_realname=numexpr
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-$_realname")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=2.7.2
pkgrel=1
pkgdesc="Fast numerical array expression evaluator for Python, NumPy, PyTables, pandas (mingw-w64)"
arch=('any')
url="https://github.com/pydata/numexpr"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-numpy")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-gcc")
source=("${_realname}-${pkgver}.tar.gz"::https://github.com/pydata/numexpr/archive/v${pkgver}.tar.gz)
sha256sums=('7d1b3790103221feda07f4a93a4fa5c6654f46865197a677ca6f27eb5cb4e5ef')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --skip-build \
  --prefix=${MINGW_PREFIX} --root=${pkgdir} --optimize=1

  install -Dm644 LICENSE.txt \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"
}
